# from multiprocessing.pool import ThreadPool
# python 并发编程
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import  ProcessPoolExecutor
import time
import  random

def task(message):
    time.sleep(random.randint(1,10)*0.1)
    return message

if __name__ == '__main__':
    executor=ThreadPoolExecutor(5)
    for i in range(5):
        future=executor.submit(task,('{} test thread pool'.format(i),))
        print(future.done())
        print(future.result())
        time.sleep(2)
        print(future.done())
        print(future.result())
